<?php 

session_start();

require("../../conexao/ConectaMysql.class.php");
require("../../conexao/ControleAcesso.class.php");

require("../../cadastro/setor/gerencia_setor.class.php");
require("../../cadastro/funcionario/gerencia_funcionario.class.php");
require("../categoria/gerencia_categoria.class.php");
require("../situacao/gerencia_situacao.class.php");
require("gerencia_resposta.class.php");

ControleAcesso::verificaSessao();
$conexao = new ConectaMysql();

$GerenciaSetor 			= new GerenciaSetor($conexao);
$GerenciaCategoria 		= new GerenciaCategoria($conexao);
$GerenciaFuncionario 	= new GerenciaFuncionario($conexao);
$GerenciaResposta   	= new GerenciaResposta($conexao);
$GerenciaSituacao		= new GerenciaSituacao($conexao);


if (isset($_GET['HELPid'])){
	
	$HELPid = $_GET['HELPid'];
	$result_resposta = $GerenciaResposta->selectResposta($HELPid);
	foreach($result_resposta as $row_resposta){  
		$HELP_SETid	  		= $row_resposta['SETid'];
		$HELP_FUNid    		= $row_resposta['FUNid'];
		$HELPtitulo 		= $row_resposta['HELPtitulo'];
		$HELPconteudo 		= $row_resposta['HELPconteudo'];
		$HELP_CATid 		= $row_resposta['CATid'];
		$HELP_DEST_SETid	= $row_resposta['HELP_DEST_SETid'];
		$HELP_SITid			= $row_resposta['SITid'];
		$HELP_SITdescricao	= $row_resposta['SITdescricao'];		
		$RESP_FUNid			= $row_resposta['RESP_FUNid'];
		$RESPconteudo		= $row_resposta['RESPconteudo'];

	}
	
?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Resposta</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../estrutura/css/estruturaCadastro.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../../estrutura/js/jquery.js"></script>
<script type="text/javascript" src="../../estrutura/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../estrutura/js/validacaoHelpdesk.js"></script>
<script type="text/javascript" src="requisicao_combo.js"></script>
</head>

<body>
<div align="left">
    <form action="" method="post" name="formHelpdesk" id="formHelpdesk" target="_self">
    <input type="hidden" id="HELPid" name="HELPid" value="<?php echo "$HELPid"; ?>">
    	<table width="90%"  border="0" align="center">
            <tr>
            	<td colspan="2" bgcolor="#DFEDF7" class="texto"><div align="left"></div>
            	  <strong>Informe os dados do Helpdesk</strong></td>
            </tr>
            <tr>
                <td width="21%" bgcolor="#FFFFFF" class="texto">&nbsp;</td>
                <td width="79%">&nbsp;</td>
            </tr>
            <tr>
                <td bgcolor="#F1F4F8" class="texto">Setor</td>
                <td>
                	<label>
                	<select id="SETid" name="SETid" DISABLED>
                    	<?php 
                		$result_setor = $GerenciaSetor->selectSetor($HELP_SETid);					
                    	foreach($result_setor as $row_setor){ 
							$SETid 		= $row_setor['SETid'];
							$SETsigla 	= $row_setor['SETsigla'];
                    		echo "<option value=\"$SETid\">$SETsigla</option>";
						 }?>
                    </select>
                	</label>
                    </td>
            </tr>
            <tr>
              <td bgcolor="#F1F4F8" class="texto style41"><span class="texto">Funcion&aacute;rio: </span></td>
              <td>
              	<label>
                    <select id="FUNid" name="FUNid" DISABLED>
                    <?php 
                    	$result_funcionario = $GerenciaFuncionario->selectFuncionario($HELP_FUNid, true); 
                        foreach($result_funcionario as $row_funcionario){  
                        	$FUNnome 		= $row_funcionario['FUNnome'];
                            $FUNsobrenome 	= $row_funcionario['FUNsobrenome'];
                            $FUNid			= $row_funcionario['FUNid'];							
                    		echo "<option value=\"$FUNid\">$FUNnome $FUNsobrenome</option>";
                         }?>
                    </select>
                </label>                
              </td>
            </tr>
            <tr>
              <td bgcolor="#F1F4F8" class="texto style41">T&iacute;tulo</td>
              <td>
              	<label>
                	<input type="text" name="HELPtitulo" id="HELPtitulo" size="40" maxlength="35" value="<?php echo "$HELPtitulo"; ?>" DISABLED>
                </label>
             </td>
            </tr>
            <tr>
              <td valign="top" bgcolor="#F1F4F8" class="texto style41">Conte&uacute;do</td>
              <td>
              	<label>
               	  <textarea name="HELPconteudo" id="HELPconteudo" cols="35" rows="5" DISABLED><?php echo "$HELPconteudo"; ?></textarea>
                </label>
              </td>
            </tr>
            <tr>
              <td bgcolor="#F1F4F8" class="texto style41">Categoria</td>
              <td>
              	<label>
              	<select id="CATid" name="CATid" DISABLED>
					<?php 
                    $result_categoria = $GerenciaCategoria->selectCategoria($HELP_CATid);
                    
                    foreach($result_categoria as $row_categoria){ 
						$CATid 			= $row_categoria['CATid'];
						$CATdescricao 	= $row_categoria['CATdescricao'];
						echo "<option value=\"$CATid\">$CATdescricao</option>";
					}?>
                    
                </select>
                </label>
              </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td bgcolor="#F1F4F8" class="texto style41"><span class="texto">Setor Respons&aacute;vel:</span></td>
              <td><select name="SETid_dest" id="SETid_dest" disabled>
                <?php
					$result_setor_dest = $GerenciaSetor->selectSetorTI($HELP_DEST_SETid);				
					foreach($result_setor_dest as $row_setor_dest){ 
						$SETid_dest 		= $row_setor_dest['SETid'];
						$SETsigla_dest 		= $row_setor_dest['SETsigla'];
						echo "<option value=\"$SETid_dest\">$SETsigla_dest</option>";
					}?>
              </select></td>
            </tr>
            <tr>
               	<td bgcolor="#F1F4F8" class="texto style41"><span class="texto">Funcion&aacute;rio Respons&aacute;vel:</span></td>
              	<td>
              	<label>
                    <select id="RESP_FUNid" name="RESP_FUNid" DISABLED>
                    <?php 
                    	$result_funcionario_dest = $GerenciaFuncionario->selectFuncionario($RESP_FUNid, true); 
                        foreach($result_funcionario_dest as $row_funcionario_dest){  
                        	$FUNnome_dest 		= $row_funcionario_dest['FUNnome'];
                            $FUNsobrenome_dest 	= $row_funcionario_dest['FUNsobrenome'];
                            $FUNid_dest			= $row_funcionario_dest['FUNid'];
							echo "<option value=\"$FUNid_dest\">$FUNnome_dest $FUNsobrenome_dest</option>";
						}?>
                    </select>
                </label>  
                </td>
            </tr>
            <tr>
               <td valign="top" bgcolor="#F1F4F8" class="texto style41">Resposta</td>
              <td><textarea name="RESPconteudo" id="RESPconteudo" cols="35" rows="5" DISABLED><?php echo "$RESPconteudo"; ?></textarea></td>
            </tr>
            <tr>
              <td valign="top" bgcolor="#F1F4F8" class="texto style41">Status Helpdesk:</td>
              <td>
                  <select name="SITid" id="SITid" DISABLED>
                  	<?php
                  	$result_situacao = $GerenciaSituacao->selectSituacao($HELP_SITid);
				  	foreach($result_situacao as $row_situacao){ 
						$SITid 		  = $row_situacao['SITid'];
						$SITdescricao = $row_situacao['SITdescricao'];
						echo "<option value=\"$SITid\">$SITdescricao</option>";
					}
					?>
					
                  </select>
              </td>
            </tr>
            <tr>
                <td class="texto">&nbsp;</td>
                <td>&nbsp; </td>
            </tr>
            <tr>
                <td class="texto style42">&nbsp;</td>
                <td>
                   <input name="voltar" type="button" id="voltar" value="Voltar" class="caixa_texto" OnClick="location.href='../cadastro/formulario_abertos.php'"/>        
                </td>
            </tr>
		</table>
    </form>
</div>
</body>
</html>
<?php }?>